package com.jsg.sl651.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 测站类型
 */
@AllArgsConstructor
@Getter
public enum StationType {
    SWZ_SWZ("水文站，水位站",0,1),
    JSLZ_SMZFZ("降水量站，水面蒸发站", 2, 5),
    DXSZJ("地下水站（井）",6,7),
    SZZ("水质站",8,9),
    OTHER("其他",10,255)
    ;
    private final String name;
    private final int min;
    private final int max;

    public static StationType getByCode(int code) {
        for (StationType stationType : values()) {
            if (stationType.getMin() <= code && stationType.getMax() >= code) {
                return stationType;
            }
        }
        return OTHER;
    }
}
